package com.syaccp.controller;

import com.syaccp.model.TOrderCategory;
import com.syaccp.service.TOrderCategoryService;
import com.syaccp.utils.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api("素材分类")
@RestController
@RequestMapping("/api/orderCategory")
public class TOrderCategoryController {
    @Resource
    private TOrderCategoryService tOrderCategoryService;

    /**
     * 查询一级分类
     * @return
     */
    @GetMapping("/queryFirstClassify")
    public Result<List<TOrderCategory>> queryFirstClassify(){
        return Result.success(tOrderCategoryService.queryFirstClassify());
    }
    /**
     * 根据id查询二级分类
     * @return
     */
    @GetMapping("/queryLastClassify")
    public Result<List<TOrderCategory>> queryLastClassify(Integer id){
        return Result.success(tOrderCategoryService.queryLastClassify(id));
    }
}
